package server;

public class Mytest {

    public static void main(String[] args) {
        int[] dataList = new int[]{1, 2, 3, 4, 5, 6, 10, 14 ,15};
        int target = 12;
        int[] indexes = getTargetIndexes(dataList, target);
        System.out.println("indexes === [" + indexes[0] + "," + indexes[1] + "]");
    }

    public static int[] getTargetIndexes(int[] dataList, int target) {
        int[] indexes = new int[]{-1, -1};
        for (int i = 0; i < dataList.length; i++) {
            for (int j = 0; j < dataList.length; j++) {
                if (i != j && dataList[i] + dataList[j] == target){
                    indexes[0] = i;
                    indexes[1] = j;
                    break;
                }
            }
            if (indexes[0] != -1) {
                break;
            }
        }
        return indexes;
    }

}